package cn.pet.service.manage.service.impl;

import cn.pet.service.manage.entity.PetOrderDetail;
import cn.pet.service.manage.entity.vo.OrderDetailVO;
import cn.pet.service.manage.mapper.PetOrderDetailMapper;
import cn.pet.service.manage.service.PetOrderDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 订单详情表 服务实现类
 * </p>
 *
 * @author 
 * @since 2023-02-11
 */
@Service
public class PetOrderDetailServiceImpl extends ServiceImpl<PetOrderDetailMapper, PetOrderDetail> implements PetOrderDetailService {

    @Resource
    private PetOrderDetailMapper petOrderDetailMapper;

    @Value("${pet.downloadUrl}")
    private String downloadUrl;

    @Override
    public List<OrderDetailVO> listByOrderId(String orderId) {
        List<OrderDetailVO> orderDetailVOS = petOrderDetailMapper.listByOrderId(orderId);
        for (OrderDetailVO orderDetailVO : orderDetailVOS){
            orderDetailVO.setPicture(downloadUrl+"/"+orderDetailVO.getId());
        }
        return orderDetailVOS;
    }
}
